/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package lx_easyfinace;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.Serializable;
import java.math.BigDecimal;
import java.math.BigInteger;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Transient;

/**
 *
 * @author echoff <echoffmu@gmail.com>
 */
@Entity
@Table(name = "GUEST", catalog = "", schema = "EASY")
@NamedQueries({
    @NamedQuery(name = "Guest.findAll", query = "SELECT g FROM Guest g"),
    @NamedQuery(name = "Guest.findByGid", query = "SELECT g FROM Guest g WHERE g.gid = :gid"),
    @NamedQuery(name = "Guest.findByGname", query = "SELECT g FROM Guest g WHERE g.gname = :gname"),
    @NamedQuery(name = "Guest.findByGphone", query = "SELECT g FROM Guest g WHERE g.gphone = :gphone"),
    @NamedQuery(name = "Guest.findByGaddress", query = "SELECT g FROM Guest g WHERE g.gaddress = :gaddress"),
    @NamedQuery(name = "Guest.findByRole", query = "SELECT g FROM Guest g WHERE g.role = :role")})
public class Guest implements Serializable {
    @Transient
    private PropertyChangeSupport changeSupport = new PropertyChangeSupport(this);
    private static final long serialVersionUID = 1L;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Id
    @Basic(optional = false)
    @Column(name = "GID")
    private BigDecimal gid;
    @Column(name = "GNAME")
    private String gname;
    @Column(name = "GPHONE")
    private String gphone;
    @Column(name = "GADDRESS")
    private String gaddress;
    @Column(name = "ROLE")
    private BigInteger role;

    public Guest() {
    }

    public Guest(BigDecimal gid) {
        this.gid = gid;
    }

    public BigDecimal getGid() {
        return gid;
    }

    public void setGid(BigDecimal gid) {
        BigDecimal oldGid = this.gid;
        this.gid = gid;
        changeSupport.firePropertyChange("gid", oldGid, gid);
    }

    public String getGname() {
        return gname;
    }

    public void setGname(String gname) {
        String oldGname = this.gname;
        this.gname = gname;
        changeSupport.firePropertyChange("gname", oldGname, gname);
    }

    public String getGphone() {
        return gphone;
    }

    public void setGphone(String gphone) {
        String oldGphone = this.gphone;
        this.gphone = gphone;
        changeSupport.firePropertyChange("gphone", oldGphone, gphone);
    }

    public String getGaddress() {
        return gaddress;
    }

    public void setGaddress(String gaddress) {
        String oldGaddress = this.gaddress;
        this.gaddress = gaddress;
        changeSupport.firePropertyChange("gaddress", oldGaddress, gaddress);
    }

    public BigInteger getRole() {
        return role;
    }

    public void setRole(BigInteger role) {
        BigInteger oldRole = this.role;
        this.role = role;
        changeSupport.firePropertyChange("role", oldRole, role);
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (gid != null ? gid.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Guest)) {
            return false;
        }
        Guest other = (Guest) object;
        if ((this.gid == null && other.gid != null) || (this.gid != null && !this.gid.equals(other.gid))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "lx_easyfinace.Guest[ gid=" + gid + " ]";
    }

    public void addPropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.addPropertyChangeListener(listener);
    }

    public void removePropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.removePropertyChangeListener(listener);
    }
    
}
